package com.easy.component.component.bander.transformer;


import android.support.v4.view.ViewPager;
import android.view.View;

public class ScaleAlphaPageTransformer implements ViewPager.PageTransformer{
    private final float MIN_SCALE = 0.9f;
    @Override
    public void transformPage(View page, float position) {
        if(position >= -1 && position <= 1) {
            page.setScaleX(1.0f - Math.abs(position) * (1 - MIN_SCALE));
            page.setScaleY(1.0f - Math.abs(position) * (1 - MIN_SCALE));
        } else {
            page.setScaleX(MIN_SCALE);
            page.setScaleY(MIN_SCALE);
        }
    }
}
